<?php

# CONN PROCEDURE # DO EXCHANGE INVOICE
$row = tuga_multiquery("CALL do_exchange({$_POST['operation_type']},{$_POST['main_office_ref']},{$_POST['rates_ref']},
			{$_POST['rate']},{$_POST['tax2_ref']},
			{$_POST['tax3_ref']},{$_POST['Amount']},{$_POST['In']},{$_POST['Out']},{$_POST['payed']},
			{$_POST['delivered']},{$_SESSION[$SESSCD]},{$_POST['OBJCTCL']},{$_SESSION[$SESSID]},'{$_SESSION[$SESSIP]}',
			'{$sysTime}', @ExcID); SELECT @ExcID");
if ($row[0][0] > 0) {
    $ExcID = $row[0][0];
    echo '<div class="Confirm">Dados guardados com sucesso. |
        <a href="javascript:newprint(\''.$GLOBALS['APP'].'Export_Print.mex?OB=' . $ExcID . '&ID=01&MOD=MX23DF2S\',\'Printer\');">Comprovativo Impresso</a>
        </div>';
} else {
    echo '<div class="Error">Ocorreu um erro.</div>';
}